import java.util.Arrays;
import java.util.Comparator;



//无返回值无参数
@FunctionalInterface
interface NoParameterNoReturn {
    void test();
}

//无返回值一个参数
@FunctionalInterface
interface OneParameterNoReturn {
    void test(int a);
}

//无返回值多个参数
@FunctionalInterface
interface MoreParameterNoReturn {
    void test(int a,int b);
}

//有返回值无参数
@FunctionalInterface
interface NoParameterReturn {
    int test();
}

//有返回值一个参数
@FunctionalInterface
interface OneParameterReturn {
    int test(int a);
}

//有返回值多参数
@FunctionalInterface
interface MoreParameterReturn {
    int test(int a,int b);
}
public class TestDemo  {
    public static void main(String[] args) {
        MoreParameterReturn moreParameterReturn = (a,b)-> a+b;
        int ret = moreParameterReturn.test(88,99);
        System.out.println(ret);
    }
    public static void main5(String[] args) {
        OneParameterReturn oneParameterReturn = a -> a;
        int ret= oneParameterReturn.test(20);
        System.out.println(ret);
    }
    public static void main4(String[] args) {
        NoParameterReturn noParameterNoReturn = () -> 10;
        System.out.println(noParameterNoReturn.test());

    }

    public static void main3(String[] args) {
        MoreParameterNoReturn moreParameterNoReturn = (a,b)-> System.out.println(a+b);
        moreParameterNoReturn.test(1,5);

    }

    public static void main2(String[] args) {
        OneParameterNoReturn oneParameterNoReturn = a -> {int b = a;System.out.println(b);};
        oneParameterNoReturn.test(10);

    }
    public static void main1(String[] args) {
        Comparator<Integer> comparator = new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1 - o2;
            }


        };

        //Lambda表达式
        Integer[] array = {8,4,5,3,2,1,10,11,4};
        Comparator<Integer> comparator1 = (o1,o2) -> o1- o2;

        Arrays.sort(array,comparator1);
        System.out.println(Arrays.toString(array));
        }

}
